import { getdetailApi } from "../utils/api.js";

const detail = {
  state() {
    return {
      detaillist: {},
    };
  },
  mutations: {
    //将获取的数据传入返回值
    getDetailList(state, payload) {
      state.detaillist = payload;
    },
  },
  actions: {
    //获取详情页接口的返回数据
    getDetailList({ commit }, payload) {
      return new Promise((resolve) => {
        getdetailApi(payload).then((res) => {
          commit("getDetailList", res.result);
          resolve();
        });
      });
    },
  },
};

export default detail;
